﻿#include "DAAbstractNodeFactory.h"
#include <QPointer>
#include <DAWorkFlow.h>

namespace DA
{
class DAAbstractNodeFactoryPrivate
{
    DA_IMPL_PUBLIC(DAAbstractNodeFactory)
public:
    DAAbstractNodeFactoryPrivate(DAAbstractNodeFactory* p);

public:
    QPointer< DAWorkFlow > _workflow;
};
}

//////////////////////////////////////////////
///
//////////////////////////////////////////////
///
using namespace DA;

//////////////////////////////////////////////
/// DAAbstractNodeFactoryPrivate
//////////////////////////////////////////////

DAAbstractNodeFactoryPrivate::DAAbstractNodeFactoryPrivate(DAAbstractNodeFactory* p) : q_ptr(p)
{
}

//////////////////////////////////////////////
/// DAAbstractNodeFactory
//////////////////////////////////////////////

DAAbstractNodeFactory::DAAbstractNodeFactory(QObject* p) : QObject(p), d_ptr(new DAAbstractNodeFactoryPrivate(this))
{
}

DAAbstractNodeFactory::~DAAbstractNodeFactory()
{
}

void DAAbstractNodeFactory::registWorkflow(DAWorkFlow* wf)
{
    d_ptr->_workflow = wf;
}

/**
 * @brief 获取工作流
 * @return
 */
DAWorkFlow* DAAbstractNodeFactory::getWorkFlow() const
{
    return d_ptr->_workflow.data();
}

void DAAbstractNodeFactory::nodeAddedToWorkflow(DAAbstractNode::SharedPointer node)
{
    Q_UNUSED(node);
}

void DAAbstractNodeFactory::nodeStartRemove(DAAbstractNode::SharedPointer node)
{
    Q_UNUSED(node);
}

void DAAbstractNodeFactory::nodeLinkSucceed(DAAbstractNode::SharedPointer outNode,
                                            const QString& outKey,
                                            DAAbstractNode::SharedPointer inNode,
                                            const QString& inkey)
{
    Q_UNUSED(outNode);
    Q_UNUSED(outKey);
    Q_UNUSED(inNode);
    Q_UNUSED(inkey);
}

void DAAbstractNodeFactory::nodeLinkDetached(DAAbstractNode::SharedPointer outNode,
                                             const QString& outKey,
                                             DAAbstractNode::SharedPointer inNode,
                                             const QString& inkey)
{
    Q_UNUSED(outNode);
    Q_UNUSED(outKey);
    Q_UNUSED(inNode);
    Q_UNUSED(inkey);
}

void DAAbstractNodeFactory::saveExternInfoToXml(QDomDocument* doc, QDomElement* factoryExternElement) const
{
    Q_UNUSED(doc);
    Q_UNUSED(factoryExternElement);
}

void DAAbstractNodeFactory::loadExternInfoFromXml(const QDomElement* factoryExternElement)
{
    Q_UNUSED(factoryExternElement);
}
